﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:a="clr-namespace:VisualPoint.Controls.Actions"
             xmlns:local="clr-namespace:VisualPoint.Controls.Views" x:Class="VisualPoint.Controls.Views.ActionListControl"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <ToolBar VerticalAlignment="Top" Grid.Row="0" Background="White" Height="30">
            <Button x:Name="btnFileOpenAction" Command="{Binding FileOpenActionCommand}"  ToolTip="Add a Open File Action">
                <Image Source="/VisualPoint.Controls;component/Images/FileOpen.png"   />
            </Button>
            <Button x:Name="btnFileCloseAction" Command="{Binding FileCloseActionCommand}" ToolTip="Add a Close File Action">
                <Image Source="/VisualPoint.Controls;component/Images/FileClose.png"   />
            </Button>

            <Separator/>

            <Button x:Name="btnTextSelectAction" Command="{Binding TextSelectActionCommand}" ToolTip="Add a Select Text Action">
                <Image Source="/VisualPoint.Controls;component/Images/TextSelect.png"   />
            </Button>
            <Button x:Name="btnTextWriteAction" Command="{Binding TextWriteActionCommand}" ToolTip="Add a Write Text Action">
                <Image Source="/VisualPoint.Controls;component/Images/TextWrite.png"   />
            </Button>

            <Separator/>

            <Button x:Name="btnWindowSelectAction" Command="{Binding WindowSelectActionCommand}" ToolTip="Add a Select Window Action">
                <Image Source="/VisualPoint.Controls;component/Images/maximize.png"   />
            </Button>

            <Separator/>

            <Button Command="{Binding ResizeActionCommand}" ToolTip="Add a Resize Action">
                <Image Source="/VisualPoint.Controls;component/Images/fullscreen.png"   />
            </Button>

            <Separator/>


            <Button x:Name="btnEditAction" Command="{Binding EditCommand}" ToolTip="Edit item" >
                <Image Source="/VisualPoint.Controls;component/Images/edit.png"   />
            </Button>
            <Button x:Name="btnDeleteAction" Command="{Binding DeleteCommand}" ToolTip="Delete item">
                <Image Source="/VisualPoint.Controls;component/Images/delete.png"   />
            </Button>

            <Separator/>

            <Button Command="{Binding CopyCommand}" ToolTip="Copy to clipboard">
                <Image Source="/VisualPoint.Controls;component/Images/copy.png"   />
            </Button>
            <Button Command="{Binding PasteCommand}" ToolTip="Paste from clipboard">
                <Image Source="/VisualPoint.Controls;component/Images/clipboard.png"   />
            </Button>

            <Separator/>

            <Button Command="{Binding MoveItemUpCommand}" ToolTip="Move item up">
                <Image Source="/VisualPoint.Controls;component/Images/up.png"   />
            </Button>
            <Button Command="{Binding MoveItemDownCommand}" ToolTip="Move item down">
                <Image Source="/VisualPoint.Controls;component/Images/down.png"   />
            </Button>

            <Separator/>

            <Button Command="{Binding RunCommand}" ToolTip="Run action">
                <Image Source="/VisualPoint.Controls;component/Images/run.png"   />
            </Button>
            <Button Command="{Binding WindowConfigurationCommand}" ToolTip="Manage Window Configuration">
                <Image Source="/VisualPoint.Controls;component/Images/WindowsConfiguration.png"   />
            </Button>

        </ToolBar>

        <ListBox x:Name="List" DataContext="{Binding Model}" ItemsSource="{Binding Actions}" Grid.Row="1" SelectedItem="{Binding SelectedItem}">
            <ListBox.ItemTemplate>
                <DataTemplate DataType="{x:Type a:BaseAction}" >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Button Command="{Binding EditCommand}" Grid.Column="0" Height="26" ToolTip="Edit item">
                            <Image Source="/VisualPoint.Controls;component/Images/edit.png"   />
                        </Button>

                        <StackPanel Orientation="Horizontal"  Grid.Column="2" DataContext="{Binding Action}" Margin="10,0,0,0">
                            <local:ActionTimeView Grid.Column="1" ActionTime="{Binding ActionTime, Mode=TwoWay}" />
                            <TextBlock Text="{Binding Name}" Margin="10,0,0,0"/>
                            <TextBlock Text="{Binding Description}" MaxHeight="50" Margin="10,0,0,0"/>
                        </StackPanel>

                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>

        <TextBlock Text="{Binding Message}" Height="24"
                   Grid.Row="2"/>
        
    </Grid>
</UserControl>
